\chapter{\modes{}}
\label{app:modes}

The \modes{} program calculates vibrational modes using data created by
\dftbp{}.


\section{Input for \modes}

The input file for \modes{} must be named \verb|modes_in.hsd| and should be a
Human-friendly Structured Data (HSD) formatted file (see Appendix \ref{sec:hsd})
and must be present in the working directory.

The table below contains the list of the properties, which must occur in the
input file \verb|modes_in.hsd|:

\begin{ptableh}
  \kw{Geometry} & p|m &  & - & \pref{sec:dftbp.Geometry} \\
  \kw{Hessian} & p & & \cb & \pref{sec:modes.Hessian} \\
  \kw{SlaterKosterFiles} &p|m&  & - &  \\
\end{ptableh}

Additionally optional definitions may be present:
\begin{ptableh}
  \kw{DisplayModes} & p & & - & \pref{sec:modes.DisplayModes} \\
  \kw{Atoms} & i+|m &  & 1:-1 & \\
  \kw{WriteHSDInput} & l & & No & \\
  \kw{RemoveTranslation} & l & & No & \\
  \kw{RemoveRotation} & l & & No & \\
  \kw{Masses} & p & & & \pref{sec:modes.Masses} \\
\end{ptableh}

\begin{description}
\item[\is{Geometry}] Specifies the geometry for the system to be
  calculated.  See p.~\pref{sec:dftbp.Geometry}.
\item[\is{Hessian}] Contains the second derivatives matrix of the
  system energy with respect to atomic positions. See
  p.~\pref{sec:modes.Hessian}.
\item[\is{SlaterKosterFiles}] Name of the Slater-Koster files for every atom
  type pair combination. See p.~\pref{sec:dftbp.SlaterKosterFiles}.
\item[\is{DisplayModes}] Optional settings to plot the eigenmodes of the
  vibrations. See p.~\pref{sec:modes.DisplayModes}.
\item[\is{Atoms}] Optional list of atoms, ranges of atoms and/or the species of
  atoms for which the Hessian has been supplied. \emph{This must be equivalent
    to the setting you used for \is{MovedAtoms} in your \dftbp{} input when
    generating the Hessian.}
\item[\is{WriteHSDInput}] Specifies, if the processed input should be written
  out in HSD format. (You shouldn't turn it off without good reason.)
\item[\is{RemoveTranslation}] Explicitly set the 3 translational modes of the
  system to be at 0 frequency.
\item[\is{RemoveRotation}] Explicitly set the rotation modes of the system to be
  at 0 frequency. Note, for periodic systems, this is usually incorrect (if used
  for a molecule full inside the central cell, it may be harmless).
\item[\is{Masses}] If present, replace the atomic masses from the Slater-Koster files. See
  p.~\pref{sec:modes.Masses}
\end{description}


\subsection{Hessian\{\}}
\label{sec:modes.Hessian}

Contains the second derivatives\index{Hessian} of the energy supplied by
{\dftbp}, see p.~\pref{sec:dftbp.SecondDerivatives} for details of the options
to generate this data. The derivatives matrix must be stored as the following
order: For the $i$, $j$ and $k$ directions of atoms $1 \ldots n$
as
\begin{equation*}
  \frac{\partial^2 E}{\partial x_{i1} \partial x_{i1}} \frac{\partial^2
    E}{\partial x_{j1} \partial x_{i1}} \frac{\partial^2 E}{\partial x_{k1}
    \partial x_{i1}} \frac{\partial^2 E}{\partial x_{i2} \partial x_{i1}}
  \frac{\partial^2 E}{\partial x_{j2} \partial x_{i1}} \frac{\partial^2
    E}{\partial x_{k2} \partial x_{i1}} \ldots \frac{\partial^2 E}{\partial
    x_{kn} \partial x_{kn}}
\end{equation*}

{\em Note}: for supercell calculations, the modes are currently
obtained at the $\mathbf{q}=0$ point, irrespective of the k-point
sampling used.


\subsection{DisplayModes\{\}}
\label{sec:modes.DisplayModes}

Allows the eigenvectors of the system to be plotted out if present

\begin{ptable}
\kw{PlotModes} & i+|m &  & 1:-1 & \\
\kw{Animate} & l & & Yes &  \\
\kw{XMakeMol} & l & & Yes &  \\
\end{ptable}
\begin{description}
\item[\is{PlotModes}] Specifies list of which eigenmodes should be
  plotted as xyz files. Remember that there are $3N$ modes for the
  system (including translation and rotation).
\item[\is{Animate}] Produce separate animation files for each mode or
  a single file multiple modes where the mode vectors are marked for
  each atom.
\item[\is{XMakeMol}] Adapt xyz format output for XMakeMol dialect xyz
  files.
\end{description}

\subsubsection{Masses}
\label{sec:modes.Masses}

Provides values of atomic masses for specified atoms, ranges of atoms or chemical species. This is
useful for example to set isotopes for specific atoms in the system.

\begin{ptable}
  \kw{Mass} & p & & & \\
\end{ptable}

Any atoms not given specified masses will use the default values from the appropriate homonuclear
Slater-Koster file. An example is given below:
\begin{verbatim}
  Masses {
    Mass {
      Atoms = H
      MassPerAtom [amu] = 1.007825
    }
    Mass {
      Atoms = C
      MassPerAtom [amu] = 13.003355
    }
    Mass {
      Atoms = 1:2
      MassPerAtom [amu] = 2.014102
    }

  }
\end{verbatim}
where \kw{Atoms} specifies the atom or atoms which each have a mass of \kw{MassPerAtom} assigned.
